﻿/*
///    This file is part of BannerLib4Net.
///
///    BannerLib4Net is free software: you can redistribute it and/or modify
///    it under the terms of the GNU General Public License as published by
///    the Free Software Foundation, either version 3 of the License, or
///    (at your option) any later version.

///    BannerLib4Net is distributed in the hope that it will be useful,
///    but WITHOUT ANY WARRANTY; without even the implied warranty of
///    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
///    GNU General Public License for more details.
///
///    You should have received a copy of the GNU General Public License
///    along with BannerLib4Net.  If not, see <http://www.gnu.org/licenses/>.
*/


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BannerLib4Net.Data.Models
{
    public abstract class BaseModel : IModel
    {
        #region public members

        public virtual Int64? DatabaseKey { get; set; }
        public virtual string Description { get; set; }
        public virtual string Name { get; set; }
        public virtual string Notes { get; set; }

        public virtual bool Active { get; set; }
        public virtual DateTime? DateEdited { get; set; }
        public virtual DateTime? DateCreated { get; set; }
        public virtual string CreatedBy { get; set; }
        public virtual string EditedBy { get; set; }
        public virtual int? AssociateKey { get; set; }
        public virtual int? SortOrder { get; set; }

        #endregion

        public BaseModel()
        {
            Initialize();
        }

        private void Initialize()
        {
            Active = true;
            DateCreated = DateTime.Now;
        }

        public virtual bool IsNew()
        {
            return (this.DatabaseKey == null || this.DatabaseKey <= 0);
        }
    }
}
